package com.ws.server;

import java.io.IOException;

import javax.xml.ws.Endpoint;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;

import com.ws.impl.HelloWorldWs;
import com.ws.interceptor.AuthInterceptor;

public class ServerMain {

	public static void main(String[] args) throws IOException {
		Endpoint endpoint = Endpoint.publish("http://localhost:8989/HelloWorld", new HelloWorldWs());
		EndpointImpl endpointImpl =(EndpointImpl) endpoint;
		
		//添加in拦截器
		endpointImpl.getInInterceptors().add(new AuthInterceptor());
		endpointImpl.getInInterceptors().add(new LoggingInInterceptor());
		//添加out拦截器
		endpointImpl.getOutInterceptors().add(new LoggingOutInterceptor());
		
		System.out.println("发布成功！");
	}
}
